Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: General JSX types export for jsx-runtime, fixes TS4.1 compatibility #2811

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

ddprrt
Copy link
Contributor

@ddprrt ddprrt commented Oct 30, 2020

This is Re: microsoft/TypeScript#41330 - @weswigham's Pull Request makes sure to pick up the right types when using the new JSX transforms, looking for a general JSX namespace export. This also gets rid of the JSX namespace exports within each factory.

However, what I've seen is that TypeScript compiles to the React "convention" for jsx-runtime, which is with a configuration like that:

{
  "compilerOptions": {
    ...
    "jsx": "react-jsx", 
    "jsxImportSource": "preact",
  }
}

The imports become e.g.

var jsx_runtime_js_1 = require("preact/jsx-runtime.js");

I think setting the configuration to

{
  "compilerOptions": {
    ...
    "jsx": "react-jsx", 
    "jsxImportSource": "preact/compat",
  }
}

should do the trick with #2805 being merged. This would require another jsx-dev-runtime.js in compat to make it fully compatible with all compiler options.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 9204b0a on ddprrt:master into 415a5ca on preactjs:master.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thank you for the PR 🙌

@marvinhagemeister marvinhagemeister merged commit 475815d into preactjs:master Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants